<?php
class category_infoModel extends baseModel{
    protected $table = 'category';

    //获取栏目基本信息
    public function info($cid,$urlname=false)
    {
        if(!$urlname){
            $where='A.cid='.$cid;
        }else{
            $where='A.urlname="'.$cid.'"';
        }

        $sql="
            SELECT A.*,B.model,C.url
            FROM {$this->model->pre}category A
            INNER JOIN {$this->model->pre}model B ON B.mid =A.mid
            LEFT JOIN {$this->model->pre}category_jump C ON C.cid =A.cid
            WHERE {$where} ORDER BY A.cid desc LIMIT 1
            ";
        $info=$this->query($sql);
        return $info[0];
    }

}
